﻿using Id4.Models;
using Microsoft.AspNetCore.Mvc;
using System.Diagnostics;
using Serilog;
using Microsoft.Extensions.Logging;

namespace Id4.Controllers;
public class HomeController : Controller
{
    private readonly ILogger<HomeController> _logger;

    public HomeController(ILogger<HomeController> logger)
    {
        _logger = logger;
    }

    public IActionResult Index()
    {
        //_logger.LogWarning(".NET 6 日志记录");
        //_logger.LogInformation(".NET 6 细腻日志记录");

        _logger.Log(LogLevel.Information, "日志记录");

        Log.Information("Hello!222222222222");
        //throw new Exception("-----------------------");
        _logger.LogInformation("ddddddddddddddd");
        return View();
    }

    public IActionResult Privacy()
    {
        return View();
    }

    [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
    public IActionResult Error()
    {
        return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
    }
}
